<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<LINK rel="Bookmark" href="/favicon.ico" >
<LINK rel="Shortcut Icon" href="/favicon.ico" />
<!--[if lt IE 9]>
<script type="text/javascript" src="/Public/Assets/Hui/lib/html5.js"></script>
<script type="text/javascript" src="/Public/Assets/Hui/lib/respond.min.js"></script>
<script type="text/javascript" src="/Public/Assets/Hui/lib/PIE_IE678.js"></script>
<![endif]-->
<link href="/Public/Assets/Hui/css/H-ui.min.css" rel="stylesheet" type="text/css" />
<link href="/Public/Assets/Hui/css/H-ui.admin.css" rel="stylesheet" type="text/css" />
<link href="/Public/Assets/Hui/lib/validator/jquery.validator.css" rel="stylesheet" type="text/css" />
<link href="/Public/Assets/Hui/lib/Hui-iconfont/1.0.1/iconfont.css" rel="stylesheet" type="text/css" />
<link href="/Public/Assets/Miniweb/lib/datepicker/dist/datepicker.min.css" rel="stylesheet" type="text/css" />
<link href="/Public/Assets/Hui/css/pagecss.css?v=1.0.0" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="/Public/Assets/Hui/lib/zTree/v3/css/zTreeStyle/zTreeStyle.css" type="text/css">
<link rel="stylesheet" type="text/css" href="/Public/Assets/Miniweb/lib/treeTable/treeTable.css" />
<link href="/Public/Assets/Hui/lib/icheck/icheck.css" rel="stylesheet" type="text/css" />
<!--[if IE 6]>
<script type="text/javascript" src="/Public/Assets/Hui/lib/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<title>Administator管理后台</title>



</head>
<body>

<div class="pd-20">
	<form action="<?php echo u('Lessonadmin/edit_post');?>" method="post" class="form form-horizontal validator_form close-dialog" id="form-article-add">
		 
		<div class="row cl">
			<label class="form-label col-2"><span class="c-red">*</span>校区：</label>
			<div class="formControls col-8">
			  <span class="select-box inline">
					<select name="did" id="district" class="select">
						<?php echo ($districtoptions); ?>
					</select>
				</span>
			</div>
			<div class="col-2"> </div>
		</div>
		<div class="row cl">
			<label class="form-label col-2"><span class="c-red">*</span>班级：</label>
			<div class="formControls col-8">
			  <span class="select-box inline">
					<select name="cid" id="class" class="select" data-cid="<?php echo ($info["cid"]); ?>">
					</select>
				</span>
			</div>
			<div class="col-2"> </div>
		</div>
		<div class="row cl">
			<label class="form-label col-2"><span class="c-red">*</span>课堂类型：</label>
			<div class="formControls col-8">
			  <span class="select-box inline">
			  		 <?php $lesson_type = C('LESSON_TYPE'); ?>
					<select name="lessontype" class="select">
						<?php if(is_array($lesson_type)): foreach($lesson_type as $key=>$vo): ?><option value="<?php echo ($key); ?>" <?php if($info['lessontype'] == $key): ?>selected<?php endif; ?>><?php echo ($vo); ?></option><?php endforeach; endif; ?>
					</select>
				</span>
			</div>
			<div class="col-2"> </div>
		</div>
		<div class="row cl">
			<label class="form-label col-2"><span class="c-red">*</span>课堂代码：</label>
			<div class="formControls col-2">
			  	<input type="text" class="input-text" value="<?php echo ($info["lessoncode"]); ?>" placeholder="" name="lessoncode"  data-rule="课堂代码:required;">
			</div>
			<div class="col-4"> </div>
		</div>
		<div class="row cl">
			<label class="form-label col-2"><span class="c-red">*</span>课堂对象（岁）：</label>
			<div class="formControls col-2">
			  	<input type="text" class="input-text" value="<?php echo ($info["lessontarget"]); ?>" placeholder="" name="lessontarget"  data-rule="课堂对象:required;">
			</div>
			<div class="col-4"> </div>
		</div>
		<div class="row cl">
			<label class="form-label col-2"><span class="c-red">*</span>上课时间：</label>
			<div class="formControls col-4">
			  	<input type="text" class="input-text" value="<?php echo ($info["lessontime"]); ?>" placeholder="" name="lessontime"  data-rule="上课时间:required;">
			</div>
			<div class="col-4"> </div>
		</div>
		<div class="row cl">
			<label class="form-label col-2"><span class="c-red">*</span>名额：</label>
			<div class="formControls col-2">
			  	<input type="text" class="input-text" value="<?php echo ($info["number"]); ?>" placeholder="" name="number"  data-rule="名额:required;integer[+]">
			</div>
			<div class="col-4"> </div>
		</div>
		<div class="row cl">
			<label class="form-label col-2"><span class="c-red">*</span>总课时：</label>
			<div class="formControls col-2">
			  	<input type="text" class="input-text" value="<?php echo ($info["worktotal"]); ?>" placeholder="" name="worktotal"  data-rule="总课时:required;integer[+];filter">
			</div>
			<label class="form-label col-2"><span class="c-red">*</span>课次：</label>
			<div class="formControls col-2">
			  	<input type="text" class="input-text" value="<?php echo ($info["worknum"]); ?>" placeholder="" name="worknum"  data-rule="课次:required;integer[+];filter">
			</div>
			<div class="col-4"> </div>
		</div>
		<div class="row cl">
			<label class="form-label col-2"><span class="c-red">*</span>单价：</label>
			<div class="formControls col-2">
			  	<input type="text" class="input-text" value="<?php echo ($info["price"]); ?>" placeholder="" name="price"  data-rule="单价:required;price;" data-rule-price="[/^\d{1,10}(\.\d{1,2})?$/,'格式不正确']" >
			</div>
			<label class="form-label col-2"><span class="c-red">*</span>材料费：</label>
			<div class="formControls col-2">
			  	<input type="text" class="input-text" value="<?php echo ((isset($info["materialcost"]) && ($info["materialcost"] !== ""))?($info["materialcost"]):'0'); ?>" placeholder="" name="materialcost"  data-rule="材料费:required;price;" data-rule-price="[/^\d{1,10}(\.\d{1,2})?$/,'格式不正确']">
			</div>
			<div class="col-4"> </div>
		</div>
		<div class="row cl">
			<label class="form-label col-2"><span class="c-red">*</span>总价：</label>
			<div class="formControls col-2">
			  	<input type="text" class="input-text" value="<?php echo ($info["total"]); ?>" placeholder="" name="total"  data-rule="总价:required;price;" data-rule-price="[/^\d{1,10}(\.\d{1,2})?$/,'格式不正确']">
			</div>
			<div class="col-4"> </div>
		</div>
		<div class="row cl">
			<label class="form-label col-2">优惠(元)：</label>
			<div class="formControls col-2">
			  	<input type="text" class="input-text" value="<?php echo ($info["discount"]); ?>" placeholder="" name="discount">
			</div>
			<label class="form-label col-2">老生折扣（%）：</label>
			<div class="formControls col-2">
			  	<input type="text" class="input-text" value="<?php echo ($info["oidstudentdiscount"]); ?>" placeholder="" name="oidstudentdiscount">
			</div>
			<div class="col-4"> </div>
		</div>
		<div class="row cl">
			<label class="form-label col-2">备注：</label>
			<div class="formControls col-10">
				<textarea name="desc" cols="" rows="" class="textarea"  placeholder="说点什么...最少输入10个字符" datatype="*10-100" dragonfly="true" nullmsg="备注不能为空！" onKeyUp="textarealength(this,200)"><?php echo ($info["desc"]); ?></textarea>
				<p class="textarea-numberbar"><em class="textarea-length">0</em>/200</p>
			</div>
		</div>
	  	<div class="row cl">
	    	<div class="col-9 col-offset-2">
	    		<input type="hidden" name="id" value="<?php echo ($info['id']); ?>">
	      		<input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
	    	</div>
	  	</div>
	</form>
</div>


<script type="text/javascript" src="/Public/Assets/Hui/lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="/Public/Assets/Hui/lib/validator/jquery.validator.js"></script> 
<script type="text/javascript" src="/Public/Assets/Hui/lib/validator/local/zh_CN.js"></script> 
<script type="text/javascript" src="/Public/Sea/modules/layer/2.1/layer/layer.js"></script>
<script type="text/javascript" src="/Public/Assets/Miniweb/lib/datepicker/dist/datepicker.min.js"></script>
<script type="text/javascript" src="/Public/Assets/Miniweb/lib/datepicker/i18n/datepicker.zh-CN.js"></script>
<script type="text/javascript" src="/Public/Assets/Hui/lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="/Public/Assets/Hui/lib/zTree/v3/js/jquery.ztree.all-3.5.min.js"></script> 
<script type="text/javascript" src="/Public/Assets/Miniweb/lib/treeTable/treeTable.js"></script>
<script type="text/javascript" src="/Public/Assets/Hui/js/H-ui.js"></script> 
<script type="text/javascript" src="/Public/Assets/Hui/js/H-ui.admin.js"></script> 
<script type="text/javascript" src="/Public/Assets/Hui/lib/icheck/jquery.icheck.min.js"></script>
<script type="text/javascript" src="/Public/Assets/Miniweb/mini-admin.js"></script> 



<script type="text/javascript">
$(function(){
	$('.skin-minimal input').iCheck({
		checkboxClass: 'icheckbox-blue',
		radioClass: 'iradio-blue',
		increaseArea: '20%'
	});
	
	$('.mini-time').datepicker();
	
	get_class();
	
});

$("input[name='worknum']").blur(function(){
	get_total();
});
$("input[name='price']").blur(function(){
	get_total();
});
$("input[name='materialcost']").blur(function(){
	get_total();
});

function get_total(){
	var total;
	var worknum = $("input[name='worknum']").val();//课次
	var price = $("input[name='price']").val();//单价
	var materialcost = $("input[name='materialcost']").val();//材料费
	if(worknum !=='' && price !=='' && materialcost!==''){
		total = (parseFloat(price)+parseFloat(materialcost))*parseInt(worknum);
		$("input[name='total']").val(total);
	}
}

function get_class(){
	var html = selected = '';
	var did = $("#district").val();
	var cid = $("#class").attr("data-cid");
	$.post("/Ygcl/Classadmin/get_class",{did:did},function(data){
		if(data.status){
			var obj = data.info;
			for ( var p in obj ){
				if(cid == obj[p]['id']){
					selected = 'selected';
				}else{
					selected = '';
				}
				html +='<option value="'+obj[p]['id']+'" '+selected+'>'+obj[p]['title']+'</option>';
			}
			$("#class").empty().append(html);
		}else{
			$("#class").empty();
		}
	})
}
$("#district").change(function(){
	get_class();
})
</script>

</body>
</html>